//
//  YMTakePassengerDialogView.swift
//  Driver
//
//  Created by lantaiyuan on 2017/10/30.
//  Copyright © 2017年 youmy. All rights reserved.
//

import UIKit

class YMTakePassengerDialogView: UIView {
    
    typealias cancelCloure = (_ isCancel: Bool)->()
    
    var cancel:cancelCloure?
    
    @IBOutlet var view: UIView!
    
    @IBOutlet weak var startLb: UILabel!
    @IBOutlet weak var endLb: UILabel!
    
    @IBOutlet weak var journeyLb: UILabel!
    @IBOutlet weak var hourLb: UILabel!
    @IBOutlet weak var peoplesLb: UILabel!
    @IBOutlet weak var moneyLb: UILabel!

    @IBOutlet weak var circleConstraintH: NSLayoutConstraint!
    @IBOutlet weak var circleConstraintW: NSLayoutConstraint!
    
    @IBAction func cancelAction(_ sender: UIButton) {
        if cancel != nil {
            cancel!(true)
        }
    }
    
    @IBAction func submitAction(_ sender: UIButton) {
        if cancel != nil {
            cancel!(false)
        }
    }
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setup()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        setup()
    }
    
    private func setup(){
        let bundle = Bundle(for: type(of: self))
        let nib = UINib(nibName: "YMTakePassengerDialogView", bundle: bundle)
        self.view = nib.instantiate(withOwner: self, options: nil)[0] as! UIView
        self.view.frame = bounds
        self.addSubview(self.view)
        
        let width = (self.view.frame.size.width - 75) / 4.0
        circleConstraintH.constant = width
        circleConstraintW.constant = width
    }
}
